package com.xjj.service.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xjj.entity.ParentAdvice;
import com.xjj.service.mapper.ParentAdviceMapper;
import com.xjj.service.service.ParentAdviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description 家长通知
 * @Author zhangjin
 * @Date 2022/10/20 10:12
 */
@Service
public class ParentAdviceImpl extends ServiceImpl<ParentAdviceMapper, ParentAdvice> implements ParentAdviceService {
    @Autowired
    private ParentAdviceMapper mapper;

    @Override
    public Integer addAdviceReader(ParentAdvice parentAdvice) {
        ParentAdvice advice = mapper.getAdvice(parentAdvice);
        if (advice==null){
            mapper.insert(parentAdvice);
        }
        // 查询数量
        int readNum = mapper.getReadNum(parentAdvice);
        return readNum;
    }
}
